clearvars -except Globaloption option

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This code reads in the VAR dynamics and produce the Campbell-Shiller decomposition in the paper
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Load data

loaddata_4CIjoint_annual;
ttime = [startdate:enddate];

output_rp = 0.03;

%% Estimation
run ../../tools/cs_estimation.m

%% steady-state upper bound calculation
upper = exp(pxbar) * (mean(taxrevgdp - spendgdp));

gdpreturn = output_rp + y0nom_1 + yspr0 - pi0;

save MAT/USpreWWIpara.mat k0x k1x s upper pdX pxbar gdpreturn

%% bootstrap
run ../../tools/BS_compute.m

save MAT/benchmark_US_before1914.mat k0x k1x s upper pdX pxbar gdpreturn s std_coeff gdebt output_rp pdT pdG CFT CFG DR taxrevgdp spendgdp


